import { BasicColumn, FormSchema } from '@/components/Table';
import { h, ref } from 'vue';
import { Tag } from 'ant-design-vue';

import { useUserStore } from '@/store/modules/user';

const userStore = useUserStore();

//表格列名
export const columns: BasicColumn[] = [
  {
    title: '字典名称',
    dataIndex: 'name',
  },
  {
    title: '类别',
    dataIndex: 'type',
    width: 120,
    customRender: ({ record }) => {
      const type = record.type;
      let text = '';
      switch (type) {
        case 1:
          text = '费用类型';
          break;
      }
      // return text;
      return h(Tag, null, () => text);
    },
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'keyword',
    label: '字典名称',
    component: 'Input',
    colProps: { span: 8 },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'name',
    label: '字典名称',
    required: true,
    component: 'Input',
  },
  {
    field: 'type',
    label: '类别',
    component: 'Select',
    required: true,
    defaultValue: 1,
    componentProps: {
      options: [{ label: '费用类型', value: 1 }],
    },
  },
];
